package com.xsd.awen.web;

import com.xsd.awen.config.WebResult;
import com.xsd.awen.domain.entity.App;
import com.xsd.awen.domain.vo.AppVo;
import com.xsd.awen.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("app")
public class AppController {

    @Autowired
    AppService appService;

    @PostMapping("page")
    public String page(AppVo appVo){
        return WebResult.page(appService.page(appVo));
    }

    @PostMapping("add")
    public String add(App app){
        return appService.save(app);
    }

    @PostMapping("update")
    public String update(App app){
        return appService.update(app);
    }

    @PostMapping("delete")
    public String delete(App app){
        return appService.delete(app);
    }

    @PostMapping("get")
    public String get(App app){
        return WebResult.OK(appService.getById(app.getId()));
    }

}